Ext.namespace('Divo');
Ext.namespace('Divo.app');

Divo.app.ProduceForm = Ext.extend(Divo.Base.EditForm, {
      fields : new Ext.util.MixedCollection(),
      dataRecordMeta : Ext.data.Record.create([{
            name : "_p_record_status",
            type : "string"
          }, {
            name : "id",
            type : "float"
          }, {
            name : "name",
            type : "string"
          }, {
            name : "shortName",
            type : "string"
          }, {
            name : "address",
            type : "string"
          }, {
            name : "tel",
            type : "string"
          }, {
            name : "person",
            type : "float"
          }, {
            name : "country",
            type : "string"
          }]),
      initComponent : function() {
        var me = this;
        var tn = 1;

        this.fields.add("_p_record_status", new Ext.form.Hidden({
                  name : "_p_record_status"
                }));
        this.fields.add("id", new Ext.form.Hidden({
                  name : "id",
                  dataIndex : "id",
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("name", new app.base.TextField({
                  name : "name",
                  dataIndex : "name",
                  fieldLabel : "生产商名",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("shortName", new app.base.TextField({
                  name : "shortName",
                  dataIndex : "shortName",
                  fieldLabel : "简称",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("address", new app.base.TextField({
                  name : "address",
                  dataIndex : "address",
                  fieldLabel : "地址",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("tel", new app.base.NumberField({
                  name : "tel",
                  dataIndex : "tel",
                  fieldLabel : "电话",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("person", new app.base.TextField({
                  name : "person",
                  dataIndex : "person",
                  fieldLabel : "联系人",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("country", new app.base.TextField({
                  name : "country",
                  dataIndex : "country",
                  fieldLabel : "国别",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  insert_allowed : true,
                  update_allowed : true
                }));
        Ext.apply(this, {
              items : [this.fields.get("_p_record_status"), {
                layout : "form",
                columnWidth : 1,
                labelAlign : "right",
                labelWidth : 100,
                items : [this.fields.get("id"), this.fields.get("name"),
                    this.fields.get("shortName"), this.fields.get("address"),
                    this.fields.get("tel"), this.fields.get("person"),
                    this.fields.get("country")]
              }],
              border : false,
              frame : true,
              firstFocusFieldName : "name"
            });

        Divo.app.ProduceForm.superclass.initComponent.apply(this, arguments);
      }

      ,
      onRender : function() {
        Divo.app.ProduceForm.superclass.onRender.apply(this, arguments);
      },
      newDataRecord : function() {
        return new this.dataRecordMeta({
              _p_record_status : "insert",
              id : "",
              name : "",
              sId : "",
              state : ""
            });
      }

    });
Ext.reg("Divo.app.ProduceForm", Divo.app.ProduceForm);